-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom toXContent implementations #13833
Conversation
Signed-off-by: Shivansh Arora <hishiv@amazon.com>
❌ Gradle check result for d844a7f: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
@@ -101,13 +104,46 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws | |||
builder.startObject(); | |||
{ | |||
builder.field("repository", entry.repository); | |||
if (params.param(Metadata.CONTEXT_MODE_PARAM, Metadata.CONTEXT_MODE_API).equals(Metadata.CONTEXT_MODE_GATEWAY)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about the BWC for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By default when we are using toXContent API mode is passed, we only pass Gateway when we are saving cluster state as persisted state in remote. So, by default I am putting the params as API and only adding extra fields if the mode is Gateway mode which is only used in our use case.
Signed-off-by: Shivansh Arora <hishiv@amazon.com>
❌ Gradle check result for 5a0cf23: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
❌ Gradle check result for d02aed3: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #13833 +/- ##
============================================
+ Coverage 71.42% 71.62% +0.20%
- Complexity 59978 61348 +1370
============================================
Files 4985 5063 +78
Lines 282275 288416 +6141
Branches 40946 41770 +824
============================================
+ Hits 201603 206592 +4989
- Misses 63999 64764 +765
- Partials 16673 17060 +387 ☔ View full report in Codecov by Sentry. |
String currentFieldName = parser.currentName(); | ||
parser.nextToken(); | ||
switch (currentFieldName) { | ||
case "snapshot": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: could be made constant.
Description
[Describe what this change achieves]
Related Issues
Resolves #[Issue number to be closed when this PR is merged]
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.